Skip to content

Implement agent skills#1304

Open
geffzhang wants to merge 14 commits intomasterfrom
implement-agent-skills
Open

Implement agent skills#1304
geffzhang wants to merge 14 commits intomasterfrom
implement-agent-skills

Conversation

@geffzhang
Copy link
Collaborator

This pull request adds a new .aspire/settings.json file to the project, specifying the path to the application host project. This configuration helps tools locate the main application entry point.

Configuration update:

  • Added .aspire/settings.json with an appHostPath pointing to ..\src\BotSharp.AppHost\BotSharp.AppHost.csproj.
    This pull request introduces a new .aspire/settings.json configuration file, specifying the path to the application's host project. This change helps standardize project settings and improve environment setup.

Configuration:

  • Added .aspire/settings.json to define the appHostPath pointing to BotSharp.AppHost.csproj.

Copilot AI and others added 11 commits January 15, 2026 08:26
Co-authored-by: geffzhang <439390+geffzhang@users.noreply.github.com>
Co-authored-by: geffzhang <439390+geffzhang@users.noreply.github.com>
Replaces custom skill loading, parsing, and function callback logic with the AgentSkillsDotNet package. Removes legacy code for skill management, utilities, and function callbacks, and introduces new hooks and adapters for integration. Updates dependency references and project files accordingly, and migrates skill definitions and scripts to the new structure.
Major refactor of the Agent Skills plugin to integrate AgentSkillsDotNet, introducing a new SkillService, improved tool registration, and enhanced configuration and security. Adds new hooks for instruction and function injection, restructures plugin initialization, and provides comprehensive documentation, migration guides, and extensive tests and sample skills for validation.
Introduce explicit AgentSkills function callbacks and a controller, and refactor skill service and plugin registration.

- Add three IFunctionCallback implementations: GetInstructionsFn, GetSkillBynameFn and GetSkillFileContentFn, plus DTOs GetSkillArgs and SkillFileContentArgs.
- Register the new function callbacks in AgentSkillsPlugin and update AgentSkillsFunctionHook to expose corresponding FunctionDef entries for function-based lookup/read operations.
- Add SkillController with an authorized GET /skills endpoint to return agent-specific skills.
- Refactor ISkillService/SkillService to return per-agent skill lists and remove the previous AITool/AIFunction tool-generation path (including the AIToolCallbackAdapter now commented out and related GetTools/GetAsTools logic removed).
- Remove Microsoft.Extensions.AI.Abstractions package from the project file and add small data/config tweaks (agent.json llmConfig and appsettings.json model/provider and ProjectSkillsDir updates).

These changes move from dynamic AIFunction tool generation to explicit function callbacks and controller endpoints, and add per-agent skill filtering to better control which skills are exposed.
Remove the AsAITool method from AgentSkill and delete the AgentSkillsAsToolsStrategy enum and ServiceCollectionExtensions files. This cleans up obsolete tools-generation APIs and a convenience service registration helper; update any callers to the new tool/factory patterns as needed.
@qodo-code-review
Copy link
Contributor

Review Summary by Qodo

Implement Agent Skills plugin with skill discovery, management, and integration

✨ Enhancement 🧪 Tests

Grey Divider

Walkthroughs

Description
  * Implements comprehensive Agent Skills plugin for BotSharp with skill discovery, loading, and
  management capabilities
  * Adds SkillService for managing agent skills with support for project and user-level skill
  directories, dynamic reloading, and thread-safe operations
  * Introduces skill model (AgentSkill) with validation, XML instruction generation, and SKILL.md
  file parsing with YAML frontmatter support
  * Implements three skill-related tools: get-available-skills, get-skill-by-name, and
  read-skill-file-content with security checks and error handling
  * Adds instruction and function hooks (AgentSkillsInstructionHook, AgentSkillsFunctionHook) for
  seamless agent integration with progressive disclosure pattern guidance
  * Extends Agent model with Skills property and updates repository layers (File and MongoDB) for
  skill persistence
  * Includes comprehensive test suite with 40+ unit tests, property-based tests using CsCheck, and
  integration tests covering DI, configuration, and real skill loading scenarios
  * Adds sample skills (data-analysis, PDF processing, web-scraping, employee-handbook,
  secret-formulas) demonstrating skill structure and capabilities
  * Updates dependencies: Microsoft.Extensions.AI.Abstractions to 10.2.0, adds YamlDotNet 16.3.0,
  and test frameworks (FluentAssertions, CsCheck, coverlet)
  * Includes detailed documentation: CHANGELOG, test guidelines, property-based testing documentation,
  and skill directory structure
Diagram
flowchart LR
  A["Agent Model"] -->|"extends with Skills"| B["Agent Skills Plugin"]
  B -->|"loads from"| C["Skill Directories"]
  C -->|"parses SKILL.md"| D["AgentSkillReader"]
  D -->|"creates"| E["AgentSkill Objects"]
  E -->|"managed by"| F["SkillService"]
  F -->|"provides to"| G["Agent Hooks"]
  G -->|"injects instructions"| H["Agent Instructions"]
  G -->|"registers tools"| I["Agent Functions"]
  I -->|"executes"| J["Skill Tools"]
  B -->|"persists to"| K["File/MongoDB Repository"]
Loading

Grey Divider

File Changes

1. tests/BotSharp.Plugin.AgentSkills.Tests/Hooks/AgentSkillsHooksPropertyTests.cs 🧪 Tests +680/-0

Property-based tests for Agent Skills hooks validation

• Added comprehensive property-based tests for Agent Skills hooks using CsCheck framework
• Tests agent type filtering behavior (Routing/Planning agents skip injection, others receive it)
• Validates instruction format correctness (XML structure, valid parsing)
• Verifies tool name uniqueness across multiple invocations and duplicate prevention
• Tests consistency and deterministic behavior across multiple test scenarios

tests/BotSharp.Plugin.AgentSkills.Tests/Hooks/AgentSkillsHooksPropertyTests.cs


2. tests/BotSharp.Plugin.AgentSkills.Tests/Hooks/AgentSkillsHooksTests.cs 🧪 Tests +592/-0

Unit tests for Agent Skills hooks implementation

• Added unit tests for AgentSkillsInstructionHook covering skill injection logic
• Tests agent type filtering (Routing/Planning agents excluded, others included)
• Validates XML format correctness and empty instruction handling
• Added unit tests for AgentSkillsFunctionHook covering tool registration
• Tests duplicate prevention, parameter conversion, and exception handling

tests/BotSharp.Plugin.AgentSkills.Tests/Hooks/AgentSkillsHooksTests.cs


3. tests/BotSharp.Plugin.AgentSkills.Tests/Integration/AgentSkillsPluginIntegrationTests.cs 🧪 Tests +445/-0

Integration tests for AgentSkillsPlugin DI and initialization

• Added integration tests for complete plugin loading and initialization flow
• Tests DI container registration of all services (settings, factory, skill service)
• Validates configuration loading from IConfiguration and skill directory loading
• Tests tool registration as IFunctionCallback and hook registration as IAgentHook
• Includes end-to-end workflow tests and error scenario handling (non-existent directories)
• Tests singleton and scoped service lifetime behaviors

tests/BotSharp.Plugin.AgentSkills.Tests/Integration/AgentSkillsPluginIntegrationTests.cs


View more (95)
4. tests/BotSharp.Plugin.AgentSkills.Tests/Settings/AgentSkillsSettingsTests.cs 🧪 Tests +454/-0

Unit tests for AgentSkillsSettings configuration validation

• Added unit tests for AgentSkillsSettings configuration class
• Tests default values for all configuration properties
• Validates configuration binding from IConfiguration with custom values
• Tests validation logic for invalid configurations (zero/negative values, disabled sources)
• Tests helper methods for directory path resolution with default and custom paths
• Validates boundary conditions and multiple error scenarios

tests/BotSharp.Plugin.AgentSkills.Tests/Settings/AgentSkillsSettingsTests.cs


5. tests/BotSharp.Plugin.AgentSkills.Tests/Functions/AIToolCallbackAdapterTests.cs 🧪 Tests +368/-0

Unit tests for AIToolCallbackAdapter tool execution

• Added unit tests for AIToolCallbackAdapter class covering tool execution
• Tests constructor validation and null parameter handling
• Validates successful execution with valid JSON arguments and case-insensitive parsing
• Tests error handling for invalid JSON, file not found, unauthorized access, and size limits
• Includes logging verification tests for different log levels
• Tests edge cases like null returns and empty strings

tests/BotSharp.Plugin.AgentSkills.Tests/Functions/AIToolCallbackAdapterTests.cs


6. tests/BotSharp.Plugin.AgentSkills.Tests/Services/SkillServicePropertyTests.cs 🧪 Tests +282/-0

Property-based tests for SkillService consistency and idempotency

• Added property-based tests for SkillService using CsCheck framework
• Tests skill loading idempotency (multiple loads return same results)
• Validates skill count consistency across different access methods
• Tests reload behavior produces identical results to initial load
• Tests empty and non-existent directory handling without throwing exceptions

tests/BotSharp.Plugin.AgentSkills.Tests/Services/SkillServicePropertyTests.cs


7. tests/BotSharp.Plugin.AgentSkills.Tests/Services/SkillServiceTests.cs 🧪 Tests +325/-0

Integration tests for SkillService with real AgentSkillsDotNet

• Added integration tests for SkillService using real AgentSkillsDotNet library
• Tests skill loading from test directory and instruction XML generation
• Validates tool list generation and skill count accuracy
• Tests configuration respect for EnableProjectSkills and EnableUserSkills flags
• Tests reload functionality and thread safety with concurrent calls
• Tests error handling for missing directories and disabled skill sources

tests/BotSharp.Plugin.AgentSkills.Tests/Services/SkillServiceTests.cs


8. src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs ✨ Enhancement +246/-0

SkillService implementation for skill management

• Implemented SkillService class for managing Agent Skills
• Added skill initialization from configured project and user directories
• Implemented GetInstructions() method to generate XML format skill instructions
• Added GetAgentSkills() methods for retrieving skills with validation
• Implemented ReloadSkillsAsync() for dynamic skill reloading with thread safety
• Added comprehensive error handling and logging throughout

src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs


9. src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Agent.cs ✨ Enhancement +24/-0

MongoDB agent skills persistence support

• Added UpdateAgentSkills() method to handle agent skill updates in MongoDB
• Added AgentField.Skills case in UpdateAgent() switch statement
• Updated UpdateAgentAllFields() to include skills serialization to MongoDB
• Converts AgentSkill objects to AgentSkillMongoElement for persistence

src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Agent.cs


10. src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentDocument.cs ✨ Enhancement +1/-0

AgentDocument schema extension for skills

• Added Skills property to AgentDocument collection model
• Property stores list of AgentSkillMongoElement objects for agent skills
• Enables MongoDB persistence of agent-skill associations

src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentDocument.cs


11. src/Plugins/BotSharp.Plugin.AgentSkills/Functions/AIToolCallbackAdapter.cs ✨ Enhancement +148/-0

AIFunction to IFunctionCallback adapter implementation

• Commented-out adapter class implementing IFunctionCallback interface
• Converts Microsoft.Extensions.AI AIFunction to BotSharp's function callback pattern
• Includes JSON argument parsing with case-insensitive configuration
• Comprehensive error handling for file operations, access violations, and size limits

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/AIToolCallbackAdapter.cs


12. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs ✨ Enhancement +209/-0

Agent skill model with validation and definition generation

• Defines AgentSkill model with metadata (name, description, license, compatibility)
• Implements validation logic checking naming conventions and character limits
• Generates XML-formatted skill definitions for AI agent consumption
• Organizes associated files into categories (scripts, references, assets, other)

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs


13. src/Plugins/BotSharp.Plugin.AgentSkills/Settings/AgentSkillsSettings.cs ⚙️ Configuration changes +160/-0

Agent Skills plugin configuration and settings management

• Configuration class for Agent Skills plugin with 10+ configurable properties
• Supports user-level and project-level skill directories with path resolution
• Includes validation methods for configuration integrity
• Configurable caching, output size limits, and tool enablement flags

src/Plugins/BotSharp.Plugin.AgentSkills/Settings/AgentSkillsSettings.cs


14. src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsFunctionHook.cs ✨ Enhancement +147/-0

Agent skills function registration hook implementation

• Hook for registering skill-related functions when agent functions load
• Registers three tools: get-skill-by-name, read-skill-file-content, GetInstructionsFn
• Converts AIFunction schema to BotSharp FunctionParametersDef format
• Includes error handling to prevent tool registration failures from interrupting agent loading

src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsFunctionHook.cs


15. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillReader.cs ✨ Enhancement +153/-0

SKILL.md file parser with frontmatter support

• Parses SKILL.md files with YAML frontmatter format
• Extracts metadata (name, description, license, compatibility, allowed-tools)
• Organizes associated files from subdirectories (scripts, references, assets)
• Handles both frontmatter-based and full-file-as-body content patterns

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillReader.cs


16. tests/BotSharp.Plugin.AgentSkills.Tests/TestSetupTests.cs 🧪 Tests +125/-0

Test setup and configuration validation tests

• Validates test project configuration and skill directory structure
• Tests existence of four test skills (valid-skill, minimal-skill, skill-with-scripts,
 large-content-skill)
• Verifies directory organization and file presence
• Confirms configuration settings are properly loaded

tests/BotSharp.Plugin.AgentSkills.Tests/TestSetupTests.cs


17. src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsInstructionHook.cs ✨ Enhancement +100/-0

Agent skills instruction injection hook

• Injects skill instructions into agent prompts during instruction loading
• Skips injection for Routing and Planning type agents
• Provides progressive disclosure pattern guidance in instruction template
• Includes error handling to prevent injection failures from interrupting agent loading

src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsInstructionHook.cs


18. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsAsToolsOptions.cs ⚙️ Configuration changes +62/-0

Agent skills tool generation options configuration

• Configuration options for skill tool generation and naming
• Defines default tool names (get-available-skills, get-skill-by-name,
 read-skill-file-content)
• Controls inclusion of file content reading tools
• Customizable tool descriptions and behavior options

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsAsToolsOptions.cs


19. tests/BotSharp.Plugin.AgentSkills.Tests/TestBase.cs 🧪 Tests +105/-0

Test base class with common setup and utilities

• Base class for Agent Skills test suite with common setup
• Configures service provider, logging, and test skills directory
• Provides helper methods for service resolution and skill path access
• Implements IDisposable for proper resource cleanup

tests/BotSharp.Plugin.AgentSkills.Tests/TestBase.cs


20. src/Plugins/BotSharp.Plugin.AgentSkills/AgentSkillsPlugin.cs ✨ Enhancement +57/-0

Agent Skills plugin registration and dependency injection

• Plugin entry point implementing IBotSharpPlugin interface
• Registers dependency injection services for skills functionality
• Configures AgentSkillsSettings, AgentSkillsFactory, ISkillService
• Registers instruction and function hooks for agent integration

src/Plugins/BotSharp.Plugin.AgentSkills/AgentSkillsPlugin.cs


21. src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Agent.cs ✨ Enhancement +23/-0

Agent skills persistence in file repository

• Adds UpdateAgentSkills method to persist agent skills to file storage
• Handles AgentField.Skills case in UpdateAgent method
• Includes skills in UpdateAgentAllFields method
• Maintains timestamp updates when skills are modified

src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Agent.cs


22. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsFactory.cs ✨ Enhancement +76/-0

Agent skills factory with discovery and validation

• Factory class for discovering and loading agent skills from directories
• Supports three validation rule levels (Strict, Loose, None)
• Applies optional filtering to loaded skills
• Tracks excluded skills with detailed exclusion reasons

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsFactory.cs


23. src/Plugins/BotSharp.Plugin.AgentSkills/Services/ISkillService.cs ✨ Enhancement +50/-0

Skill service interface definition

• Service interface for managing agent skills
• Defines methods for skill retrieval, instruction generation, and reloading
• Supports both global and agent-specific skill queries
• Includes skill count tracking for monitoring purposes

src/Plugins/BotSharp.Plugin.AgentSkills/Services/ISkillService.cs


24. src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetInstructionsFn.cs ✨ Enhancement +63/-0

Get available skills function implementation

• Function callback for get-available-skills tool
• Retrieves agent-specific skills and formats as XML
• Returns skill name, description, and location information
• Handles empty skill lists gracefully

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetInstructionsFn.cs


25. src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillFileContentFn.cs ✨ Enhancement +58/-0

Read skill file content function implementation

• Function callback for read-skill-file-content tool
• Validates file paths against allowed skill files
• Reads and returns file content with security checks
• Prevents access to files outside skill directories

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillFileContentFn.cs


26. src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillBynameFn.cs ✨ Enhancement +48/-0

Get skill by name function implementation

• Function callback for get-skill-by-name tool
• Retrieves specific skill by name with case-insensitive matching
• Generates skill definition using configured options
• Returns error message if skill not found

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillBynameFn.cs


27. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillAsToolOptions.cs ⚙️ Configuration changes +52/-0

Individual skill tool representation options

• Configuration options for individual skill tool representation
• Controls inclusion of metadata (description, files, license, compatibility)
• Enables selective file type inclusion (scripts, references, assets, other)
• Customizable metadata and allowed tools information

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillAsToolOptions.cs


28. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkills.cs ✨ Enhancement +41/-0

Agent skills collection and instruction generation

• Container class for a collection of agent skills
• Generates XML-formatted instruction text for AI agents
• Tracks excluded skills with detailed logging
• Provides skill list with name, description, and location

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkills.cs


29. src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs ✨ Enhancement +12/-0

Agent model extended with skills support

• Adds Skills property to Agent model as list of AgentSkill
• Includes SetSkills fluent builder method
• Updates Clone method to copy skills
• Initializes skills as empty list by default

src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs


30. src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/Request/AgentCreationModel.cs ✨ Enhancement +2/-0

Agent creation model extended with skills

• Adds Skills property to agent creation request model
• Maps skills from creation model to domain agent
• Initializes skills as empty list if not provided

src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/Request/AgentCreationModel.cs


31. src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentSkillMongoElement.cs ✨ Enhancement +44/-0

MongoDB agent skill persistence model

• MongoDB persistence model for agent skills
• Maps between domain AgentSkill and MongoDB element
• Stores skill name and description
• Provides conversion methods for serialization

src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentSkillMongoElement.cs


32. tests/BotSharp.Plugin.AgentSkills.Tests/Helpers/TestLogger.cs 🧪 Tests +35/-0

Test logger helper for unit tests

• Simple test logger implementation for unit testing
• Captures log messages with log level information
• Provides read-only access to logged messages
• Implements ILogger<T> interface

tests/BotSharp.Plugin.AgentSkills.Tests/Helpers/TestLogger.cs


33. src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.UpdateAgent.cs ✨ Enhancement +1/-0

Agent service skills update support

• Adds skills initialization in agent update operations
• Ensures skills are set to empty list if null
• Maintains consistency with other agent field updates

src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.UpdateAgent.cs


34. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsOptionsValidationRule.cs ✨ Enhancement +22/-0

Agent skills validation rule enumeration

• Enum defining three validation rule levels for skill loading
• Strict: Enforces full Agent Skills specification compliance
• Loose: Requires only skill name presence
• None: Accepts all skills without validation

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsOptionsValidationRule.cs


35. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsOptions.cs ⚙️ Configuration changes +17/-0

Agent skills discovery options configuration

• Options class for skill discovery and loading
• Supports custom filtering function for skill selection
• Configurable validation rules (Strict, Loose, None)
• Validation applied before filtering

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsOptions.cs


36. src/Plugins/BotSharp.Plugin.AgentSkills/Controllers/SkillController.cs ✨ Enhancement +24/-0

Skill management REST API controller

• REST API controller for skill management
• Provides GET /skills endpoint to list all agent skills
• Requires authorization for access
• Returns list of available skills

src/Plugins/BotSharp.Plugin.AgentSkills/Controllers/SkillController.cs


37. tests/BotSharp.Plugin.AgentSkills.Tests/Usings.cs 🧪 Tests +23/-0

Test project global using directives

• Global using directives for test project
• Includes test frameworks (xUnit, FluentAssertions, Moq)
• Imports Microsoft.Extensions and BotSharp namespaces
• Centralizes common imports for all test files

tests/BotSharp.Plugin.AgentSkills.Tests/Usings.cs


38. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillValidationResult.cs ✨ Enhancement +17/-0

Agent skill validation result model

• Result class for skill validation operations
• Contains validation status and list of issues
• Provides detailed feedback on validation failures

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillValidationResult.cs


39. src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentSkill.cs ✨ Enhancement +16/-0

Agent skill domain model

• Domain model for agent skills with JSON serialization
• Contains required Name and Description properties
• Uses camelCase JSON property naming
• Minimal model for skill reference in agents

src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentSkill.cs


40. src/Plugins/BotSharp.Plugin.AgentSkills/Using.cs Miscellaneous +9/-0

Agent Skills plugin global using directives

• Global using directives for Agent Skills plugin
• Imports plugin-specific and dependency namespaces
• Centralizes common imports for plugin files

src/Plugins/BotSharp.Plugin.AgentSkills/Using.cs


41. src/Infrastructure/BotSharp.Abstraction/Agents/Enums/AgentField.cs ✨ Enhancement +2/-1

Agent field enumeration extended with skills

• Adds Skills enum value to AgentField enumeration
• Enables skills as a distinct agent field for updates
• Maintains consistency with other agent field types

src/Infrastructure/BotSharp.Abstraction/Agents/Enums/AgentField.cs


42. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/SkillFileContentArgs.cs ✨ Enhancement +9/-0

Skill file content function arguments model

• Argument model for skill file content reading
• Contains FilePath property with JSON serialization
• Uses camelCase JSON naming convention

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/SkillFileContentArgs.cs


43. src/Plugins/BotSharp.Plugin.AgentSkills/Skills/GetSkillArgs.cs ✨ Enhancement +9/-0

Get skill by name function arguments model

• Argument model for get-skill-by-name function
• Contains SkillName property with JSON serialization
• Uses camelCase JSON naming convention

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/GetSkillArgs.cs


44. src/Plugins/BotSharp.Plugin.AgentSkills/data/agents/471ca181-375f-b16f-7134-5f868ecd31c6/instructions/instruction.liquid 📝 Documentation +48/-0

Agent instruction template with skills guidance

• Liquid template for agent instructions with skills integration
• Implements progressive disclosure pattern for skill usage
• Provides detailed workflow guidance for skill interaction
• Includes examples of correct and incorrect usage patterns

src/Plugins/BotSharp.Plugin.AgentSkills/data/agents/471ca181-375f-b16f-7134-5f868ecd31c6/instructions/instruction.liquid


45. src/WebStarter/AgentSkills/data-analysis/scripts/analyze_csv.py ✨ Enhancement +142/-0

CSV data analysis Python script

• Python script for CSV data analysis with statistical summaries
• Placeholder implementation with pandas integration comments
• Generates reports on shape, columns, missing values, and statistics
• Supports both text and JSON output formats

src/WebStarter/AgentSkills/data-analysis/scripts/analyze_csv.py


46. src/WebStarter/AgentSkills 📦 Other +0/-0

src/WebStarter/AgentSkills


47. tests/test-skills/large-content-skill/SKILL.md 🧪 Tests +423/-0

Large content test skill for file size validation

• Added new test skill with large SKILL.md file (>50KB) to validate file size limit handling
• Includes comprehensive documentation on MaxOutputSizeBytes configuration and testing procedures
• Contains repeated Lorem ipsum content blocks to exceed typical 50KB size limits
• Provides testing instructions and validation steps for size limit enforcement

tests/test-skills/large-content-skill/SKILL.md


48. Directory.Packages.props Dependencies +11/-1

Update dependencies for agent skills implementation

• Updated Microsoft.Extensions.AI.Abstractions from version 10.0.0 to 10.2.0
• Added YamlDotNet version 16.3.0 for YAML parsing support
• Added test dependencies: coverlet.msbuild, FluentAssertions, and CsCheck
• Added Microsoft.Extensions.Configuration.Json and Microsoft.Extensions.Logging.Console across
 multiple framework versions

Directory.Packages.props


49. src/Plugins/BotSharp.Plugin.AgentSkills/CHANGELOG.md 📝 Documentation +182/-0

Complete changelog for agent skills major refactor

• Comprehensive changelog documenting major refactor of Agent Skills plugin
• Details new AgentSkillsDotNet integration with progressive disclosure pattern
• Documents three new tools: get-available-skills, read-skill, read-skill-file,
 list-skill-directory
• Includes 110 unit tests with 90.17% code coverage and migration guide from previous versions

src/Plugins/BotSharp.Plugin.AgentSkills/CHANGELOG.md


50. tests/BotSharp.Plugin.AgentSkills.Tests/Hooks/PROPERTY_TESTS_README.md 📝 Documentation +173/-0

Property-based testing documentation for hooks

• Documents property-based tests for Agent Skills hooks using CsCheck
• Describes 11 property tests covering agent type filtering, instruction format, and tool name
 uniqueness
• Includes test execution instructions and design document references
• Explains benefits of property-based testing and future test opportunities

tests/BotSharp.Plugin.AgentSkills.Tests/Hooks/PROPERTY_TESTS_README.md


51. tests/BotSharp.Plugin.AgentSkills.Tests/README.md 📝 Documentation +229/-0

Test project documentation and guidelines

• Comprehensive test project documentation with structure and dependencies overview
• Includes test configuration, test skills directory, and writing test guidelines
• Documents code coverage goals (>80%), best practices, and CI integration
• Provides troubleshooting section and resource links

tests/BotSharp.Plugin.AgentSkills.Tests/README.md


52. src/WebStarter/AgentSkills/web-scraping/SKILL.md ✨ Enhancement +251/-0

Web scraping skill with Python BeautifulSoup integration

• New web scraping skill with BeautifulSoup and Requests libraries
• Includes three Python scripts: scrape_page.py, scrape_table.py, download_images.py
• Documents HTML parsing, data extraction, and advanced features with rate limiting
• Provides legal, ethical, and security considerations for web scraping

src/WebStarter/AgentSkills/web-scraping/SKILL.md


53. src/WebStarter/AgentSkills/pdf-processing/references/pdf_processing_guide.md 📝 Documentation +205/-0

PDF processing guide with advanced usage examples

• Detailed guide for PDF processing including installation and advanced usage
• Covers handling encrypted PDFs, OCR for scanned documents, and performance optimization
• Documents common issues with solutions and best practices
• Includes API reference for extract_text.py, extract_tables.py, and get_metadata.py

src/WebStarter/AgentSkills/pdf-processing/references/pdf_processing_guide.md


54. src/WebStarter/AgentSkills/data-analysis/SKILL.md ✨ Enhancement +184/-0

Data analysis skill with pandas and visualization

• New data analysis skill using pandas, numpy, matplotlib, and seaborn
• Includes three Python scripts: analyze_csv.py, visualize_data.py, clean_data.py
• Documents statistical analysis, data cleaning, and visualization capabilities
• Provides data format requirements, configuration options, and security notes

src/WebStarter/AgentSkills/data-analysis/SKILL.md


55. tests/test-skills/README.md 📝 Documentation +162/-0

Test skills directory documentation

• Documentation for test skills directory with four test skills
• Describes structure and purpose of each skill: valid-skill, minimal-skill, skill-with-scripts,
 large-content-skill
• Includes usage examples, validation procedures, and expected behavior
• Provides notes on skill specification compliance and testing guidelines

tests/test-skills/README.md


56. tests/test-skills/valid-skill/SKILL.md 🧪 Tests +92/-0

Comprehensive valid test skill with all features

• Complete test skill demonstrating all Agent Skills specification features
• Includes YAML frontmatter with optional fields (version, author, tags)
• Documents workflow, use cases, and examples for skill loading and resource access
• References bundled scripts, documentation, and asset files

tests/test-skills/valid-skill/SKILL.md


57. tests/test-skills/skill-with-scripts/scripts/file_operations.sh 🧪 Tests +98/-0

Bash file operations script with JSON output

• Bash script for file operations with JSON output
• Implements --help, --version, --list, and --count options
• Returns structured JSON responses with timestamps and status information
• Includes error handling for missing directories and invalid arguments

tests/test-skills/skill-with-scripts/scripts/file_operations.sh


58. src/WebStarter/AgentSkills/pdf-processing/SKILL.md ✨ Enhancement +120/-0

PDF processing skill with PyPDF2 integration

• New PDF processing skill for text and data extraction
• Includes three Python scripts: extract_text.py, extract_tables.py, get_metadata.py
• Documents prerequisites, usage examples, and configuration options
• Covers limitations, error handling, and security considerations

src/WebStarter/AgentSkills/pdf-processing/SKILL.md


59. tests/test-skills/valid-skill/references/api_reference.md 📝 Documentation +105/-0

Sample API reference documentation

• Sample API reference documentation for testing reference file functionality
• Documents authentication, endpoints (GET/POST /api/test), and data models
• Includes error handling with standard error response format
• Provides common error codes and response examples

tests/test-skills/valid-skill/references/api_reference.md


60. tests/test-skills/valid-skill/references/workflow.md 📝 Documentation +66/-0

Sample workflow documentation

• Sample workflow documentation describing skill loading and execution process
• Documents four main steps: initialization, instruction loading, resource access, execution
• Includes error handling workflows for path traversal, file size limits, and missing files
• Provides best practices for skill implementation

tests/test-skills/valid-skill/references/workflow.md


61. tests/test-skills/skill-with-scripts/SKILL.md 🧪 Tests +59/-0

Test skill with bundled Python and Bash scripts

• Test skill demonstrating script bundling with Python and Bash scripts
• Documents four bundled scripts and their purposes
• Describes usage pattern: discovery, inspection, execution, result processing
• Includes script guidelines and examples for tool usage

tests/test-skills/skill-with-scripts/SKILL.md


62. src/WebStarter/AgentSkills/web-scraping/assets/scraping_config.json ⚙️ Configuration changes +44/-0

Web scraping configuration with rate limiting

• Configuration file for web scraping skill with request, rate limiting, and security settings
• Defines timeout, retries, user-agent, and header configurations
• Includes robots.txt respect settings and parsing options
• Specifies extraction limits and security parameters

src/WebStarter/AgentSkills/web-scraping/assets/scraping_config.json


63. tests/test-skills/skill-with-scripts/scripts/system_info.sh 🧪 Tests +49/-0

Bash system information collection script

• Bash script for collecting system information with JSON output
• Implements --help and --version options
• Returns structured JSON with OS, kernel, architecture, hostname, and user information
• Includes timestamp and status fields in output

tests/test-skills/skill-with-scripts/scripts/system_info.sh


64. tests/test-skills/valid-skill/scripts/test_script.sh 🧪 Tests +49/-0

Bash test script for skill validation

• Bash test script demonstrating shell script bundling with Agent Skills
• Implements --help, --version, and --test options
• Returns JSON output with test results and metadata
• Includes shell information and sample test data

tests/test-skills/valid-skill/scripts/test_script.sh


65. src/Plugins/BotSharp.Plugin.AgentSkills/BotSharp.Plugin.AgentSkills.csproj ⚙️ Configuration changes +30/-0

Agent Skills plugin project file

• New project file for Agent Skills plugin with standard SDK configuration
• Includes content items for agent data and instruction files
• References YamlDotNet package dependency
• References BotSharp.Core project dependency

src/Plugins/BotSharp.Plugin.AgentSkills/BotSharp.Plugin.AgentSkills.csproj


66. src/Plugins/BotSharp.Plugin.AgentSkills/data/agents/471ca181-375f-b16f-7134-5f868ecd31c6/agent.json ⚙️ Configuration changes +25/-0

Agent Skill agent configuration

• Agent configuration JSON for Agent Skill agent
• Defines agent as task type with Azure OpenAI GPT-4.1 model
• Includes icon URL and skill reference to employee-handbook
• Sets max recursion depth to 5 and marks as public

src/Plugins/BotSharp.Plugin.AgentSkills/data/agents/471ca181-375f-b16f-7134-5f868ecd31c6/agent.json


67. src/WebStarter/AgentSkills/data-analysis/assets/analysis_config.json ⚙️ Configuration changes +31/-0

Data analysis configuration with visualization settings

• Configuration file for data analysis skill with data loading and cleaning settings
• Defines analysis parameters including correlation method and confidence level
• Specifies visualization style, figure size, and output format
• Includes performance settings for chunking and multiprocessing

src/WebStarter/AgentSkills/data-analysis/assets/analysis_config.json


68. tests/test-skills/valid-skill/assets/config.json 🧪 Tests +27/-0

Sample skill configuration file

• Sample configuration file for testing asset file functionality
• Includes skill metadata, settings, features, and path configurations
• Documents creation date, author, and description
• Provides example structure for skill configuration files

tests/test-skills/valid-skill/assets/config.json


69. tests/BotSharp.Plugin.AgentSkills.Tests/appsettings.test.json ⚙️ Configuration changes +23/-0

Test configuration for Agent Skills plugin

• Test configuration for Agent Skills plugin with logging and skill settings
• Enables project skills from test-skills directory
• Configures MaxOutputSizeBytes to 51200 bytes (50KB)
• Enables all skill tools: read-skill, read-file, list-directory

tests/BotSharp.Plugin.AgentSkills.Tests/appsettings.test.json


70. src/WebStarter/AgentSkills/pdf-processing/assets/config.json ⚙️ Configuration changes +21/-0

PDF processing configuration with OCR settings

• Configuration file for PDF processing skill with file size and OCR settings
• Defines table detection sensitivity and text extraction options
• Includes performance settings for batch processing and caching
• Specifies output encoding and layout mode preferences

src/WebStarter/AgentSkills/pdf-processing/assets/config.json


71. src/WebStarter/AgentSkills/secret-formulas/SKILL.md ✨ Enhancement +10/-0

Secret formulas skill with Python script reference

• Minimal skill definition for secret formulas with Python scripts
• References TheExtraSecretFormula.py script for execution
• Suggests using execute_python tool for script execution
• Demonstrates minimal skill structure with name and description

src/WebStarter/AgentSkills/secret-formulas/SKILL.md


72. .aspire/settings.json Additional files +3/-0

...

.aspire/settings.json


73. BotSharp.sln Additional files +269/-0

...

BotSharp.sln


74. src/Plugins/BotSharp.Plugin.AgentSkills/MIGRATION.md Additional files +427/-0

...

src/Plugins/BotSharp.Plugin.AgentSkills/MIGRATION.md


75. src/Plugins/BotSharp.Plugin.AgentSkills/README.md Additional files +0/-0

...

src/Plugins/BotSharp.Plugin.AgentSkills/README.md


76. src/WebStarter/AgentSkills/data-analysis/scripts/clean_data.py Additional files +105/-0

...

src/WebStarter/AgentSkills/data-analysis/scripts/clean_data.py


77. src/WebStarter/AgentSkills/data-analysis/scripts/visualize_data.py Additional files +94/-0

...

src/WebStarter/AgentSkills/data-analysis/scripts/visualize_data.py


78. src/WebStarter/AgentSkills/employee-handbook/SKILL.md Additional files +10/-0

...

src/WebStarter/AgentSkills/employee-handbook/SKILL.md


79. src/WebStarter/AgentSkills/employee-handbook/references/Benefits.md Additional files +12/-0

...

src/WebStarter/AgentSkills/employee-handbook/references/Benefits.md


80. src/WebStarter/AgentSkills/employee-handbook/references/CultureAndValues.md Additional files +9/-0

...

src/WebStarter/AgentSkills/employee-handbook/references/CultureAndValues.md


81. src/WebStarter/AgentSkills/employee-handbook/references/HoursAndAttendance.md Additional files +15/-0

...

src/WebStarter/AgentSkills/employee-handbook/references/HoursAndAttendance.md


82. src/WebStarter/AgentSkills/employee-handbook/references/Pay.md Additional files +9/-0

...

src/WebStarter/AgentSkills/employee-handbook/references/Pay.md


83. src/WebStarter/AgentSkills/pdf-processing/scripts/extract_tables.py Additional files +73/-0

...

src/WebStarter/AgentSkills/pdf-processing/scripts/extract_tables.py


84. src/WebStarter/AgentSkills/pdf-processing/scripts/extract_text.py Additional files +59/-0

...

src/WebStarter/AgentSkills/pdf-processing/scripts/extract_text.py


85. src/WebStarter/AgentSkills/pdf-processing/scripts/get_metadata.py Additional files +78/-0

...

src/WebStarter/AgentSkills/pdf-processing/scripts/get_metadata.py


86. src/WebStarter/AgentSkills/secret-formulas/scripts/TheExtraSecretFormula.py Additional files +5/-0

...

src/WebStarter/AgentSkills/secret-formulas/scripts/TheExtraSecretFormula.py


87. src/WebStarter/AgentSkills/speak-like-a-pirate/SKILL.md Additional files +16/-0

...

src/WebStarter/AgentSkills/speak-like-a-pirate/SKILL.md


88. src/WebStarter/AgentSkills/web-scraping/scripts/download_images.py Additional files +92/-0

...

src/WebStarter/AgentSkills/web-scraping/scripts/download_images.py


89. src/WebStarter/AgentSkills/web-scraping/scripts/scrape_page.py Additional files +70/-0

...

src/WebStarter/AgentSkills/web-scraping/scripts/scrape_page.py


90. src/WebStarter/AgentSkills/web-scraping/scripts/scrape_table.py Additional files +89/-0

...

src/WebStarter/AgentSkills/web-scraping/scripts/scrape_table.py


91. src/WebStarter/WebStarter.csproj Additional files +1/-0

...

src/WebStarter/WebStarter.csproj


92. src/WebStarter/appsettings.json Additional files +7/-2

...

src/WebStarter/appsettings.json


93. tests/BotSharp.Plugin.AgentSkills.Tests/BotSharp.Plugin.AgentSkills.Tests.csproj Additional files +62/-0

...

tests/BotSharp.Plugin.AgentSkills.Tests/BotSharp.Plugin.AgentSkills.Tests.csproj


94. tests/test-skills/minimal-skill/SKILL.md Additional files +16/-0

...

tests/test-skills/minimal-skill/SKILL.md


95. tests/test-skills/skill-with-scripts/scripts/data_processor.py Additional files +99/-0

...

tests/test-skills/skill-with-scripts/scripts/data_processor.py


96. tests/test-skills/skill-with-scripts/scripts/file_analyzer.py Additional files +83/-0

...

tests/test-skills/skill-with-scripts/scripts/file_analyzer.py


97. tests/test-skills/valid-skill/assets/template.txt Additional files +31/-0

...

tests/test-skills/valid-skill/assets/template.txt


98. tests/test-skills/valid-skill/scripts/test_script.py Additional files +47/-0

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Mar 9, 2026

Code Review by Qodo

🐞 Bugs (5) 📘 Rule violations (6) 📎 Requirement gaps (0)

Grey Divider


Action required

1. agentSkill null dereferenced📘 Rule violation ⛯ Reliability
Description
GetInstructions can set agentSkill to null due to a case-sensitive lookup and then dereference
it, causing a runtime NullReferenceException. This violates required null/empty boundary guards
and consistent identifier matching.
Code

src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs[R179-183]

+                        var agentSkill = agentskills.FirstOrDefault(s => s.Name== skill.Name);
+                        availableSkillToolBuilder.AppendLine("\t<skill>");
+                        availableSkillToolBuilder.AppendLine($"\t\t<name>{agentSkill.Name}</name>");
+                        availableSkillToolBuilder.AppendLine($"\t\t<description>{agentSkill.Description}</description>");
+                        availableSkillToolBuilder.AppendLine($"\t\t<location>{agentSkill.FolderPath}</location>");
Evidence
The code checks existence using OrdinalIgnoreCase but then retrieves via == (case-sensitive),
making agentSkill potentially null and immediately dereferenced without a guard.

src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs[179-183]
Best Practice: Learned patterns
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`SkillService.GetInstructions` checks skill existence using `StringComparison.OrdinalIgnoreCase` but then fetches the skill using a case-sensitive comparison and dereferences the result without a null check.
## Issue Context
This can throw `NullReferenceException` when the skill name differs only by case (or if the list changes between checks).
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs[179-184]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. SetSkills assigns shared list 📘 Rule violation ⛯ Reliability
Description
Agent.SetSkills assigns the caller-provided list directly to Skills, allowing the caller to
mutate agent state after assignment. This violates the defensive-copy requirement for
caller-provided collections.
Code

src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs[R356-359]

+    public Agent SetSkills(List<AgentSkill>? skills)
+    {
+        Skills = skills ?? [];
+        return this;
Evidence
The method accepts a list from a caller boundary and stores it by reference, creating shared mutable
state.

src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs[356-359]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`Agent.SetSkills` stores the input `skills` list by reference instead of copying it.
## Issue Context
Callers can retain the reference and mutate it later, causing unexpected agent state changes.
## Fix Focus Areas
- src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs[356-359]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. GetAgentSkills() returns internal list 📘 Rule violation ⛯ Reliability
Description
SkillService.GetAgentSkills() returns _agentSkills.Skills directly, exposing internal mutable
state to callers. External mutation can corrupt the service's cached skill state across requests.
Code

src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs[112]

+        return _agentSkills?.Skills ?? new List<Skills.AgentSkill>();
Evidence
Returning an internal list reference violates the checklist requirement to use defensive copies for
collections shared across boundaries.

src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs[112-112]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GetAgentSkills()` exposes the internal `_agentSkills.Skills` list by reference.
## Issue Context
This creates shared mutable state where callers can modify the internal cache unintentionally.
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs[110-113]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (5)
4. read-skill-file-content ignores allowlist 📘 Rule violation ⛯ Reliability
Description
GetSkillFileContentFn.Execute sets an error when the requested file is not allowed but still reads
the file unconditionally, risking exceptions and unsafe behavior. This violates the requirement to
add safe fallbacks at external/optional boundaries.
Code

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillFileContentFn.cs[R49-55]

+        if (!allowedFiles.Contains(filePath))
+        {
+             contents = $"Error: File '{filePath}' is not a valid Skill-file";
+        }
+
+        contents =  File.ReadAllText(args.FilePath, Encoding.UTF8);
+        message.Content = contents; 
Evidence
Even after detecting an invalid file path, the code proceeds to File.ReadAllText, which can throw
or read disallowed content; a guard/early return fallback is required.

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillFileContentFn.cs[49-55]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The function writes an error message for disallowed paths but still reads the file, which can throw or leak content.
## Issue Context
This is an external boundary (tool input from the model/user) and must have safe fallbacks when invalid.
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillFileContentFn.cs[45-56]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. FunctionArgs null not handled 📘 Rule violation ⛯ Reliability
Description
GetSkillBynameFn.Execute deserializes message.FunctionArgs without checking for null/empty,
which can throw at runtime. This violates the requirement for null/empty guards at optional
boundaries.
Code

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillBynameFn.cs[37]

+        var args = JsonSerializer.Deserialize<GetSkillArgs>(message.FunctionArgs) ?? new();
Evidence
The code calls JsonSerializer.Deserialize(message.FunctionArgs) directly; if FunctionArgs is
null/empty (valid boundary condition), deserialization can throw instead of returning a safe
fallback.

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillBynameFn.cs[37-37]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`FunctionArgs` is deserialized without checking for null/empty, which can throw exceptions.
## Issue Context
Tool calls can arrive without arguments or with invalid JSON; the handler should return a safe error message.
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillBynameFn.cs[34-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. GetInstructionsFn name mismatch 📘 Rule violation ✓ Correctness
Description
AgentSkillsFunctionHook registers a function named GetInstructionsFn, but the callback tool name
is get-available-skills, creating a contract mismatch. This breaks consistent API/tool naming and
can prevent correct tool binding.
Code

src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsFunctionHook.cs[R99-103]

+                functions.Add(new FunctionDef
+                {
+                    Name = "GetInstructionsFn",
+                    Description = $"Get a list of the available skills"
+                }); 
Evidence
The checklist requires consistent contracts and naming; the hook registers a different tool name
than the callback exposes, so callers looking for get-available-skills won't match the registered
definition (or vice versa).

src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsFunctionHook.cs[99-103]
src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetInstructionsFn.cs[24-26]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The function hook registers `Name = &amp;amp;quot;GetInstructionsFn&amp;amp;quot;` but the callback tool name is `&amp;amp;quot;get-available-skills&amp;amp;quot;`, causing contract mismatch.
## Issue Context
Tool routing typically matches function definitions and callbacks by name; inconsistent naming prevents correct binding.
## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsFunctionHook.cs[99-103]
- src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetInstructionsFn.cs[24-26]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Adapter type absent🐞 Bug ✓ Correctness
Description
AIToolCallbackAdapter is entirely commented out, so the type does not exist and the AgentSkills test
project that instantiates it will not compile. This blocks CI/build for the PR branch.
Code

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/AIToolCallbackAdapter.cs[R11-21]

+///// <summary>
+///// AIFunction to IFunctionCallback adapter.
+///// Adapts Microsoft.Extensions.AI AIFunction to BotSharp's IFunctionCallback interface.
+///// Implements requirements: FR-4.1, FR-4.2, FR-4.3, NFR-2.2
+///// </summary>
+//public class AIToolCallbackAdapter : IFunctionCallback
+//{
+//    private readonly AIFunction _aiFunction;
+//    private readonly IServiceProvider _serviceProvider;
+//    private readonly ILogger<AIToolCallbackAdapter> _logger;
+//    private readonly JsonSerializerOptions _jsonOptions;
Evidence
The adapter class declaration is commented out, but the test project references it directly, which
causes a compile-time missing-type error.

src/Plugins/BotSharp.Plugin.AgentSkills/Functions/AIToolCallbackAdapter.cs[11-21]
tests/BotSharp.Plugin.AgentSkills.Tests/Functions/AIToolCallbackAdapterTests.cs[12-30]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AIToolCallbackAdapter` is fully commented out, but the tests reference it, causing compilation to fail.
### Issue Context
The test project `BotSharp.Plugin.AgentSkills.Tests` directly instantiates `AIToolCallbackAdapter`, so the class must exist in the plugin assembly.
### Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Functions/AIToolCallbackAdapter.cs[1-148]
- tests/BotSharp.Plugin.AgentSkills.Tests/Functions/AIToolCallbackAdapterTests.cs[1-60]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Mongo skills dropped on read 🐞 Bug ✓ Correctness
Description
Mongo storage adds/persists AgentDocument.Skills but TransformAgentDocument does not map it back to
Agent.Skills, so skills are silently lost when agents are loaded from MongoDB. This causes agents to
appear without skills despite persisted data.
Code

src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentDocument.cs[31]

+    public List<AgentSkillMongoElement>? Skills { get; set; }
Evidence
The document schema includes Skills, but the transformation to the domain Agent omits it entirely,
so reads cannot populate Agent.Skills.

src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentDocument.cs[29-33]
src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Agent.cs[770-798]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Skills are stored in Mongo but never restored into the domain Agent model.
### Issue Context
This results in silent loss of configured skills for any agent retrieved from MongoDB.
### Fix Focus Areas
- src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Agent.cs[763-799]
- src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentDocument.cs[27-33]
- src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentSkillMongoElement.cs[27-43]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

9. Wrong description length check🐞 Bug ✓ Correctness
Description
AgentSkill.GetValidationResult validates description length using Name.Length instead of
Description.Length, producing incorrect validation results. Overlong descriptions will not be
flagged reliably.
Code

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs[R112-123]

+        if (string.IsNullOrWhiteSpace(Description))
+        {
+            valid = false;
+            issues.Add("Description: Not specified");
+        }
+        else
+        {
+            if (Name.Length > 1024)
+            {
+                valid = false;
+                issues.Add("Description: Must be 1-1024 characters");
+            }
Evidence
The code path inside the Description validation block compares Name.Length to 1024, which is
unrelated to the description length constraint it reports.

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs[112-123]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Description length validation checks the wrong field.
### Issue Context
Validation results may be used to gate loading/usage of skills.
### Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs[112-123]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Inverted tag inclusion checks 🐞 Bug ✓ Correctness
Description
AgentSkill.GenerateDefinition emits <license>, <compatibility>, and <allowedTools> only when those
values are blank because the whitespace conditions are inverted. This produces missing metadata when
values exist and may emit empty tags when they don’t.
Code

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs[R156-180]

+        if (optionsToUse.IncludeLicenseInformation && string.IsNullOrWhiteSpace(License))
+        {
+            builder.AppendLine($"<license>{License}</license>");
+        }
+
+        if (optionsToUse.IncludeCompatibilityInformation && string.IsNullOrWhiteSpace(Compatibility))
+        {
+            builder.AppendLine($"<compatibility>{Compatibility}</compatibility>");
+        }
+
+        if (optionsToUse.IncludeMetadata && Metadata?.Count > 0)
+        {
+            builder.AppendLine("<metadata>");
+            foreach (KeyValuePair<string, string> keyValuePair in Metadata)
+            {
+                builder.AppendLine($"<{keyValuePair.Key}>{keyValuePair.Value}</{keyValuePair.Key}>");
+            }
+
+            builder.AppendLine("</metadata>");
+        }
+
+        if (optionsToUse.IncludeAllowedTools && string.IsNullOrWhiteSpace(AllowedTools))
+        {
+            builder.AppendLine($"<allowedTools>{AllowedTools}</allowedTools>");
+        }
Evidence
The method checks string.IsNullOrWhiteSpace(...) as a precondition to include tags, which is the
inverse of the desired behavior (include only when there is content).

src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs[156-180]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Skill definition generation includes metadata tags only when values are empty due to inverted conditions.
### Issue Context
This output is used by tools like `get-skill-by-name` and should accurately include optional metadata.
### Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs[156-180]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Non-portable skills directory 🐞 Bug ⛯ Reliability
Description
WebStarter appsettings.json sets AgentSkills.ProjectSkillsDir to an absolute Windows developer path,
which will not exist on other machines/OSes and makes the default configuration non-portable. This
will prevent skills from loading in typical environments.
Code

src/WebStarter/appsettings.json[R1068-1072]

+  "AgentSkills": {
+    "EnableUserSkills": false,
+    "EnableProjectSkills": true,
+    "ProjectSkillsDir": "C:\\workshop\\github\\BotSharp\\src\\WebStarter\\skills"
+  },
Evidence
The committed configuration hardcodes a local absolute path; on most deployments this path will be
invalid.

src/WebStarter/appsettings.json[1068-1072]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Sample config uses an absolute Windows-only path for skills.
### Issue Context
This repo likely runs on different machines/CI/containers; a hardcoded path prevents skills from loading.
### Fix Focus Areas
- src/WebStarter/appsettings.json[1068-1072]
- src/Plugins/BotSharp.Plugin.AgentSkills/Settings/AgentSkillsSettings.cs[97-116]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Contributor

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: build (ubuntu-latest)

Failed stage: Build [❌]

Failed test name: ""

Failure summary:

The action failed during dotnet restore/build because NuGet detected a package downgrade in
src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj and
treated it as an error (NU1605: Warning As Error).
- System.Text.Encodings.Web is required as >=
10.0.2 via Microsoft.Extensions.AI.Abstractions 10.2.0 -> System.Text.Json 10.0.2
- but the project
(or solution dependency graph) resolves System.Text.Encodings.Web to 10.0.0, causing a downgrade
from 10.0.2 to 10.0.0.
This stops restore for that project and causes the overall build to fail with
exit code 1. (Other NU1901/NU1902/NU1903 vulnerability findings are warnings and not the failure
cause.)

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

886:  OK https://api.nuget.org/v3/vulnerabilities/index.json 8ms
887:  GET https://api.nuget.org/v3-vulnerabilities/2026.02.28.05.40.06/vulnerability.base.json
888:  GET https://api.nuget.org/v3-vulnerabilities/2026.02.28.05.40.06/2026.03.08.23.41.23/vulnerability.update.json
889:  OK https://api.nuget.org/v3-vulnerabilities/2026.02.28.05.40.06/vulnerability.base.json 4ms
890:  OK https://api.nuget.org/v3-vulnerabilities/2026.02.28.05.40.06/2026.03.08.23.41.23/vulnerability.update.json 16ms
891:  1>Project "/home/runner/work/BotSharp/BotSharp/BotSharp.sln" (1) is building "/home/runner/work/BotSharp/BotSharp/src/BotSharp.AppHost/BotSharp.AppHost.csproj" (65) on node 1 (Clean target(s)).
892:  65>AddReferenceToDashboardAndDCP:
893:  "/usr/share/dotnet/dotnet" exec "/home/runner/.nuget/packages/aspire.apphost.sdk/9.5.2/tools/net8.0/Aspire.RuntimeIdentifier.Tool.dll" --runtimeGraphPath "/usr/share/dotnet/sdk/10.0.102/RuntimeIdentifierGraph.json" --supportedRids "win-x64,win-x86,win-arm64,linux-x64,linux-arm64,linux-musl-x64,osx-x64,osx-arm64" --netcoreSdkRuntimeIdentifier "linux-x64"
894:  CoreClean:
895:  Creating directory "obj/Release/net8.0/".
896:  64>Done Building Project "/home/runner/work/BotSharp/BotSharp/src/WebStarter/WebStarter.csproj" (Clean target(s)).
897:  65>Done Building Project "/home/runner/work/BotSharp/BotSharp/src/BotSharp.AppHost/BotSharp.AppHost.csproj" (Clean target(s)).
898:  1>Done Building Project "/home/runner/work/BotSharp/BotSharp/BotSharp.sln" (Clean target(s)).
899:  Build succeeded.
900:  0 Warning(s)
901:  0 Error(s)
902:  Time Elapsed 00:00:05.58
...

910:  shell: /usr/bin/bash -e {0}
911:  env:
912:  DOTNET_ROOT: /usr/share/dotnet
913:  DOTNET_CLI_TELEMETRY_OPTOUT: 1
914:  DOTNET_hostBuilder:reloadConfigOnChange: false
915:  ##[endgroup]
916:  Determining projects to restore...
917:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.LangChain/BotSharp.Plugin.VertexAI.csproj (in 5.19 sec).
918:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.Qdrant/BotSharp.Plugin.Qdrant.csproj (in 5.19 sec).
919:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.RoutingSpeeder/BotSharp.Plugin.RoutingSpeeder.csproj (in 5.19 sec).
920:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.ChartHandler/BotSharp.Plugin.ChartHandler.csproj (in 6.74 sec).
921:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.Planner/BotSharp.Plugin.Planner.csproj (in 358 ms).
922:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.OpenAI/BotSharp.Plugin.OpenAI.csproj (in 1.33 sec).
923:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.OsDriver/BotSharp.Plugin.OsDriver.csproj (in 1.34 sec).
924:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MultiTenancy/BotSharp.Plugin.MultiTenancy.csproj (in 3 ms).
925:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj : error NU1605: Warning As Error: Detected package downgrade: System.Text.Encodings.Web from 10.0.2 to 10.0.0. Reference the package directly from the project to select a different version.  [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
926:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj : error NU1605:  BotSharp.Plugin.MicrosoftExtensionsAI -> Microsoft.Extensions.AI.Abstractions 10.2.0 -> System.Text.Json 10.0.2 -> System.Text.Encodings.Web (>= 10.0.2)  [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
927:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj : error NU1605:  BotSharp.Plugin.MicrosoftExtensionsAI -> System.Text.Encodings.Web (>= 10.0.0) [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
928:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PythonInterpreter/BotSharp.Plugin.PythonInterpreter.csproj (in 1.95 sec).
929:  Failed to restore /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj (in 190 ms).
930:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MetaGLM/BotSharp.Plugin.MetaGLM.csproj (in 4 ms).
...

1012:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.AgentSkills/BotSharp.Plugin.AgentSkills.csproj (in 11 ms).
1013:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Logger/BotSharp.Logger.csproj (in 3 ms).
1014:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj (in 11 ms).
1015:  Restored /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.ExcelHandler/BotSharp.Plugin.ExcelHandler.csproj (in 199 ms).
1016:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Core.SideCar/BotSharp.Core.SideCar.csproj (in 10 ms).
1017:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Core.Rules/BotSharp.Core.Rules.csproj (in 3 ms).
1018:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Core.Realtime/BotSharp.Core.Realtime.csproj (in 11 ms).
1019:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.OpenAPI/BotSharp.OpenAPI.csproj (in 73 ms).
1020:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Core.Crontab/BotSharp.Core.Crontab.csproj (in 10 ms).
1021:  Restored /home/runner/work/BotSharp/BotSharp/src/WebStarter/WebStarter.csproj (in 10.53 sec).
1022:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Core.A2A/BotSharp.Core.A2A.csproj (in 13 ms).
1023:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Abstraction.ComputerUse/BotSharp.Abstraction.ComputerUse.csproj (in 4 ms).
1024:  Restored /home/runner/work/BotSharp/BotSharp/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj (in 7 ms).
1025:  Restored /home/runner/work/BotSharp/BotSharp/src/BotSharp.ServiceDefaults/BotSharp.ServiceDefaults.csproj (in 97 ms).
1026:  Restored /home/runner/work/BotSharp/BotSharp/src/BotSharp.AppHost/BotSharp.AppHost.csproj (in 2.08 sec).
1027:  Build FAILED.
1028:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1901: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known low severity vulnerability, https://github.com/advisories/GHSA-273h-m46v-96q4 [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
...

1056:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-qp59-x883-77qv [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1057:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-qpgx-jfcq-r59f [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1058:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-r99p-5442-q2x2 [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1059:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-rw6c-xp26-225v [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1060:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1903: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known high severity vulnerability, https://github.com/advisories/GHSA-v7g2-m8c5-mf84 [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1061:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-v994-63cg-9wj3 [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1062:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1903: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known high severity vulnerability, https://github.com/advisories/GHSA-vhqj-f5cj-9x8h [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1063:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-vpxv-r9pg-7gpr [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1064:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-w8mw-frc6-r7m8 [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1065:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1901: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known low severity vulnerability, https://github.com/advisories/GHSA-wfx3-6g53-9fgc [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1066:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-wg3g-gvx5-2pmv [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1067:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1901: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known low severity vulnerability, https://github.com/advisories/GHSA-wgxp-q8xq-wpp9 [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1068:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-xgm3-v4r9-wfgm [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1069:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1901: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known low severity vulnerability, https://github.com/advisories/GHSA-xpg8-7m6m-jf56 [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1070:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.PaddleSharp/BotSharp.Plugin.PaddleSharp.csproj : warning NU1902: Package 'Magick.NET-Q16-AnyCPU' 14.9.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-xwc6-v6g8-pw2h [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1071:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj : error NU1605: Warning As Error: Detected package downgrade: System.Text.Encodings.Web from 10.0.2 to 10.0.0. Reference the package directly from the project to select a different version.  [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1072:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj : error NU1605:  BotSharp.Plugin.MicrosoftExtensionsAI -> Microsoft.Extensions.AI.Abstractions 10.2.0 -> System.Text.Json 10.0.2 -> System.Text.Encodings.Web (>= 10.0.2)  [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1073:  /home/runner/work/BotSharp/BotSharp/src/Plugins/BotSharp.Plugin.MicrosoftExtensionsAI/BotSharp.Plugin.MicrosoftExtensionsAI.csproj : error NU1605:  BotSharp.Plugin.MicrosoftExtensionsAI -> System.Text.Encodings.Web (>= 10.0.0) [/home/runner/work/BotSharp/BotSharp/BotSharp.sln]
1074:  43 Warning(s)
1075:  1 Error(s)
1076:  Time Elapsed 00:00:31.66
1077:  ##[error]Process completed with exit code 1.
1078:  Cleaning up orphan processes

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an Agent Skills capability across the BotSharp solution: adding a new AgentSkills plugin (skill discovery, instruction injection, and tool callbacks), persisting agent-selected skills in storage, and providing sample skills + a new test project to validate the implementation. It also adds an Aspire settings file for tooling.

Changes:

  • Add a new BotSharp.Plugin.AgentSkills plugin (services, hooks, functions, settings, docs) and wire it into WebStarter.
  • Extend agent persistence (file + Mongo) and OpenAPI agent creation to include Skills.
  • Add test skill fixtures and a new BotSharp.Plugin.AgentSkills.Tests project with unit/integration/property tests.

Reviewed changes

Copilot reviewed 96 out of 97 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
.aspire/settings.json Adds Aspire configuration pointing tools to the AppHost project.
Directory.Packages.props Updates/introduces centralized package versions needed for the new plugin/test project.
src/Infrastructure/BotSharp.Abstraction/Agents/Enums/AgentField.cs Adds Skills to the updatable agent fields enum.
src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs Adds Agent.Skills and cloning/setter support.
src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentSkill.cs Introduces the AgentSkill domain model.
src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.UpdateAgent.cs Ensures agent update pipeline copies Skills.
src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Agent.cs Adds persistence/update support for agent Skills in file repository.
src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/Request/AgentCreationModel.cs Adds Skills to agent creation request model and mapping.
src/Plugins/BotSharp.Plugin.AgentSkills/AgentSkillsPlugin.cs Registers AgentSkills plugin DI services, hooks, and function callbacks.
src/Plugins/BotSharp.Plugin.AgentSkills/BotSharp.Plugin.AgentSkills.csproj Adds the AgentSkills plugin project definition and packaged content.
src/Plugins/BotSharp.Plugin.AgentSkills/CHANGELOG.md Documents the plugin refactor/features.
src/Plugins/BotSharp.Plugin.AgentSkills/Controllers/SkillController.cs Adds /skills endpoint for listing loaded skills.
src/Plugins/BotSharp.Plugin.AgentSkills/Functions/AIToolCallbackAdapter.cs Contains (currently commented) adapter scaffold for AIFunction → IFunctionCallback.
src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetInstructionsFn.cs Implements get-available-skills callback.
src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillBynameFn.cs Implements get-skill-by-name callback.
src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillFileContentFn.cs Implements read-skill-file-content callback.
src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsFunctionHook.cs Registers skill-related tools during function loading.
src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsInstructionHook.cs Injects skill metadata into agent instructions (with agent type filtering).
src/Plugins/BotSharp.Plugin.AgentSkills/MIGRATION.md Migration guide for adopting the new plugin/config/structure.
src/Plugins/BotSharp.Plugin.AgentSkills/Services/ISkillService.cs Defines skill service API used by hooks and functions.
src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs Implements skill discovery/loading and instruction generation.
src/Plugins/BotSharp.Plugin.AgentSkills/Settings/AgentSkillsSettings.cs Adds configuration settings and validation for AgentSkills.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkill.cs Implements skill parsing/validation/definition generation.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillAsToolOptions.cs Options controlling skill definition generation.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillReader.cs Reads SKILL.md and enumerates skill resources (scripts/references/assets).
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillValidationResult.cs Validation result DTO for skill validation.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkills.cs Represents a skill set and builds <available_skills> instructions XML.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsAsToolsOptions.cs Options describing generated tool naming/availability.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsFactory.cs Finds skills on disk and applies validation/filter rules.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsOptions.cs Configuration options for skill discovery filtering/validation.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/AgentSkillsOptionsValidationRule.cs Defines strict/loose/none validation policies.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/GetSkillArgs.cs Defines tool args for get-skill-by-name.
src/Plugins/BotSharp.Plugin.AgentSkills/Skills/SkillFileContentArgs.cs Defines tool args for read-skill-file-content.
src/Plugins/BotSharp.Plugin.AgentSkills/Using.cs Adds global usings for the plugin.
src/Plugins/BotSharp.Plugin.AgentSkills/data/agents/471ca181-375f-b16f-7134-5f868ecd31c6/agent.json Adds an AgentSkills “skill” agent with configured skills.
src/Plugins/BotSharp.Plugin.AgentSkills/data/agents/471ca181-375f-b16f-7134-5f868ecd31c6/instructions/instruction.liquid Adds progressive-disclosure instruction content for skills usage.
src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentDocument.cs Adds Mongo agent document storage for Skills.
src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentSkillMongoElement.cs Adds Mongo DTO and mapping helpers for agent skills.
src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Agent.cs Adds skills update path and includes skills in “update all fields”.
src/WebStarter/WebStarter.csproj Adds project reference to the AgentSkills plugin.
src/WebStarter/appsettings.json Enables AgentSkills plugin loading and adds AgentSkills configuration section.
src/WebStarter/AgentSkills/data-analysis/SKILL.md Adds a sample “data-analysis” skill documentation.
src/WebStarter/AgentSkills/data-analysis/assets/analysis_config.json Adds config asset for data analysis skill.
src/WebStarter/AgentSkills/data-analysis/scripts/analyze_csv.py Adds example analysis script (placeholder implementation).
src/WebStarter/AgentSkills/data-analysis/scripts/clean_data.py Adds example cleaning script (placeholder implementation).
src/WebStarter/AgentSkills/data-analysis/scripts/visualize_data.py Adds example visualization script (placeholder implementation).
src/WebStarter/AgentSkills/employee-handbook/SKILL.md Adds employee handbook skill entry and reference links.
src/WebStarter/AgentSkills/employee-handbook/references/Benefits.md Adds handbook reference doc.
src/WebStarter/AgentSkills/employee-handbook/references/CultureAndValues.md Adds handbook reference doc.
src/WebStarter/AgentSkills/employee-handbook/references/HoursAndAttendance.md Adds handbook reference doc.
src/WebStarter/AgentSkills/employee-handbook/references/Pay.md Adds handbook reference doc.
src/WebStarter/AgentSkills/pdf-processing/SKILL.md Adds a sample “pdf-processing” skill documentation.
src/WebStarter/AgentSkills/pdf-processing/assets/config.json Adds config asset for pdf-processing skill.
src/WebStarter/AgentSkills/pdf-processing/references/pdf_processing_guide.md Adds detailed reference documentation for pdf-processing skill.
src/WebStarter/AgentSkills/pdf-processing/scripts/extract_tables.py Adds example table extraction script (placeholder implementation).
src/WebStarter/AgentSkills/pdf-processing/scripts/extract_text.py Adds example text extraction script (placeholder implementation).
src/WebStarter/AgentSkills/pdf-processing/scripts/get_metadata.py Adds example metadata extraction script (placeholder implementation).
src/WebStarter/AgentSkills/secret-formulas/SKILL.md Adds a “secret-formulas” skill stub referencing a script.
src/WebStarter/AgentSkills/secret-formulas/scripts/TheExtraSecretFormula.py Adds a simple python script for the “secret-formulas” skill.
src/WebStarter/AgentSkills/speak-like-a-pirate/SKILL.md Adds a persona-style skill definition.
src/WebStarter/AgentSkills/web-scraping/SKILL.md Adds a sample “web-scraping” skill documentation.
src/WebStarter/AgentSkills/web-scraping/assets/scraping_config.json Adds config asset for web-scraping skill.
src/WebStarter/AgentSkills/web-scraping/scripts/download_images.py Adds example image download script (placeholder implementation).
src/WebStarter/AgentSkills/web-scraping/scripts/scrape_page.py Adds example page scraping script (placeholder implementation).
src/WebStarter/AgentSkills/web-scraping/scripts/scrape_table.py Adds example table scraping script (placeholder implementation).
tests/BotSharp.Plugin.AgentSkills.Tests/BotSharp.Plugin.AgentSkills.Tests.csproj Adds a new test project for AgentSkills plugin.
tests/BotSharp.Plugin.AgentSkills.Tests/Functions/AIToolCallbackAdapterTests.cs Adds tests for the (currently missing/commented) adapter.
tests/BotSharp.Plugin.AgentSkills.Tests/Helpers/TestLogger.cs Adds a simple test logger.
tests/BotSharp.Plugin.AgentSkills.Tests/Hooks/PROPERTY_TESTS_README.md Documents property-based tests approach for hooks.
tests/BotSharp.Plugin.AgentSkills.Tests/README.md Documents how to run and structure AgentSkills tests.
tests/BotSharp.Plugin.AgentSkills.Tests/Services/SkillServicePropertyTests.cs Adds property-based tests for the skill service.
tests/BotSharp.Plugin.AgentSkills.Tests/Services/SkillServiceTests.cs Adds integration-style tests for the skill service.
tests/BotSharp.Plugin.AgentSkills.Tests/Settings/AgentSkillsSettingsTests.cs Adds unit tests for settings binding and validation.
tests/BotSharp.Plugin.AgentSkills.Tests/TestBase.cs Adds shared test setup/DI base class.
tests/BotSharp.Plugin.AgentSkills.Tests/TestSetupTests.cs Adds tests verifying fixture directories/files exist.
tests/BotSharp.Plugin.AgentSkills.Tests/Usings.cs Adds global usings for the test project.
tests/BotSharp.Plugin.AgentSkills.Tests/appsettings.test.json Adds test settings including AgentSkills section.
tests/test-skills/README.md Adds documentation describing test skill fixtures and their intended usage.
tests/test-skills/minimal-skill/SKILL.md Adds minimal skill fixture.
tests/test-skills/skill-with-scripts/SKILL.md Adds script-focused skill fixture.
tests/test-skills/skill-with-scripts/scripts/data_processor.py Adds python script fixture.
tests/test-skills/skill-with-scripts/scripts/file_analyzer.py Adds python script fixture.
tests/test-skills/skill-with-scripts/scripts/file_operations.sh Adds bash script fixture.
tests/test-skills/skill-with-scripts/scripts/system_info.sh Adds bash script fixture.
tests/test-skills/valid-skill/SKILL.md Adds full-featured skill fixture.
tests/test-skills/valid-skill/assets/config.json Adds asset fixture.
tests/test-skills/valid-skill/assets/template.txt Adds asset fixture.
tests/test-skills/valid-skill/references/api_reference.md Adds reference doc fixture.
tests/test-skills/valid-skill/references/workflow.md Adds reference doc fixture.
tests/test-skills/valid-skill/scripts/test_script.py Adds python script fixture.
tests/test-skills/valid-skill/scripts/test_script.sh Adds bash script fixture.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +49 to +55
if (!allowedFiles.Contains(filePath))
{
contents = $"Error: File '{filePath}' is not a valid Skill-file";
}

contents = File.ReadAllText(args.FilePath, Encoding.UTF8);
message.Content = contents;
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security/logic issue: even when the requested file is not in allowedFiles, the code still unconditionally reads it (File.ReadAllText(args.FilePath, ...)) and returns its contents. This bypasses the allow-list check and can expose arbitrary files if filepath is attacker-controlled. Return early on disallowed paths, and only read after validating the resolved path matches an allowed skill file (ideally normalize/resolve and compare full paths).

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +180
if (optionsToUse.IncludeLicenseInformation && string.IsNullOrWhiteSpace(License))
{
builder.AppendLine($"<license>{License}</license>");
}

if (optionsToUse.IncludeCompatibilityInformation && string.IsNullOrWhiteSpace(Compatibility))
{
builder.AppendLine($"<compatibility>{Compatibility}</compatibility>");
}

if (optionsToUse.IncludeMetadata && Metadata?.Count > 0)
{
builder.AppendLine("<metadata>");
foreach (KeyValuePair<string, string> keyValuePair in Metadata)
{
builder.AppendLine($"<{keyValuePair.Key}>{keyValuePair.Value}</{keyValuePair.Key}>");
}

builder.AppendLine("</metadata>");
}

if (optionsToUse.IncludeAllowedTools && string.IsNullOrWhiteSpace(AllowedTools))
{
builder.AppendLine($"<allowedTools>{AllowedTools}</allowedTools>");
}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional checks for optional fields are inverted: IncludeLicenseInformation/IncludeCompatibilityInformation/IncludeAllowedTools only emit tags when the value is whitespace. This results in empty elements and skips output when values are actually present. Flip these checks to emit only when the corresponding value is non-empty.

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +103
functions.Add(new FunctionDef
{
Name = "GetInstructionsFn",
Description = $"Get a list of the available skills"
});
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function registration mismatch: you register a FunctionDef named GetInstructionsFn, but the corresponding callback GetInstructionsFn advertises Name => "get-available-skills". FunctionDef.Name must match the callback Name for the tool to be invokable. Rename the FunctionDef to get-available-skills (and keep naming consistent with the other tools).

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +59
var settings = CreateSettings();

// Act - Load skills multiple times
var service1 = new SkillService(_factory, settings, _logger);
var count1 = service1.GetSkillCount();
var instructions1 = service1.GetInstructions();
var tools1 = service1.GetTools();

Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These property tests construct SkillService(_factory, settings, _logger) and call GetInstructions()/GetTools(), but the current SkillService requires an IServiceProvider and only exposes GetInstructions(Agent). As written, this test project will not compile; refactor the test harness to use the actual service signature (DI + a test Agent) or adjust the service API.

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +52
IEnumerable<string> allowedFiles = Skills.SelectMany(x => x.AssetFiles.Union(x.OtherFiles).Union(x.ScriptFiles).Union(x.ReferenceFiles));

var args = JsonSerializer.Deserialize<SkillFileContentArgs>(message.FunctionArgs) ?? new();

var filePath = args.FilePath;
var contents = string.Empty;
if (!allowedFiles.Contains(filePath))
{
contents = $"Error: File '{filePath}' is not a valid Skill-file";
}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowedFiles contains the full paths returned by Directory.GetFiles(...), but the tool argument is named filepath and is likely to be provided as a relative path (as described in SKILL.md examples). Comparing allowedFiles.Contains(filePath) will fail in normal use and is case-sensitive; normalize to full paths (e.g., combine with skill root and resolve) and compare with an ordinal-ignore-case comparer on Windows.

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +20
/// <summary>
/// Name of the Skill
/// <
public required string Name { get; set; }

Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The XML doc comment for Name is malformed (/// < without closing tags), which will break generated XML documentation and can produce warnings/errors when GenerateDocumentationFile is enabled. Fix the summary comment block to be well-formed.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
{
"appHostPath": "..\\src\\BotSharp.AppHost\\BotSharp.AppHost.csproj"
} No newline at end of file
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says the change only adds .aspire/settings.json, but this PR also introduces a large AgentSkills plugin implementation, new test projects/assets, and storage model changes. Update the PR description to accurately reflect the scope, or split into separate PRs to keep reviews manageable.

Copilot uses AI. Check for mistakes.
Comment on lines +173 to +184
if (!agentskills.Any(s => s.Name.Equals(skill.Name, StringComparison.OrdinalIgnoreCase)))
{
_logger.LogWarning("Agent {AgentName} has skill '{Skill}' which is not available in loaded skills", agent.Name, skill);
}
else
{
var agentSkill = agentskills.FirstOrDefault(s => s.Name== skill.Name);
availableSkillToolBuilder.AppendLine("\t<skill>");
availableSkillToolBuilder.AppendLine($"\t\t<name>{agentSkill.Name}</name>");
availableSkillToolBuilder.AppendLine($"\t\t<description>{agentSkill.Description}</description>");
availableSkillToolBuilder.AppendLine($"\t\t<location>{agentSkill.FolderPath}</location>");
availableSkillToolBuilder.AppendLine("\t</skill>");
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible null dereference: you check skill existence with Any(...OrdinalIgnoreCase) but then fetch it with a case-sensitive predicate (FirstOrDefault(s => s.Name== skill.Name)) and immediately dereference agentSkill.Name/Description/FolderPath. If the only difference is casing, agentSkill will be null and this will throw. Use the same case-insensitive comparison when retrieving, and guard against null before dereferencing.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +53
include = true;
break;
default:
throw new ArgumentOutOfRangeException(nameof(excludedSkillsLog));
}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default case throws ArgumentOutOfRangeException(nameof(excludedSkillsLog)), but the out-of-range value is optionsToUse.ValidationRules. Throwing with the wrong param name makes debugging harder; use the validation rule parameter/property name instead.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +75
public void Constructor_WithValidDirectory_ShouldLoadSkills()
{
// Arrange
var settings = CreateSettings();

// Act
var service = new SkillService(_factory, settings, _logger);

// Assert
service.Should().NotBeNull();
var skillCount = service.GetSkillCount();
skillCount.Should().BeGreaterThan(0, "test skills directory should contain at least one skill");
}

/// <summary>
/// Test 3.3.2: Verify GetInstructions() returns valid XML format.
/// </summary>
[Fact]
public void GetInstructions_WithLoadedSkills_ShouldReturnValidXml()
{
// Arrange
var settings = CreateSettings();
var service = new SkillService(_factory, settings, _logger);

// Act
var instructions = service.GetInstructions();

Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test uses a SkillService constructor overload and APIs (GetInstructions(), GetTools()) that don't exist on the current BotSharp.Plugin.AgentSkills.Services.SkillService implementation (it now takes IServiceProvider and GetInstructions(Agent)). Update the tests to build a DI container (register AgentSkillsSettings) and call the current public APIs, or update the service API to match the test expectations.

Copilot uses AI. Check for mistakes.
Comment on lines +356 to +359
public Agent SetSkills(List<AgentSkill>? skills)
{
Skills = skills ?? [];
return this;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. setskills assigns shared list 📘 Rule violation ⛯ Reliability

Agent.SetSkills assigns the caller-provided list directly to Skills, allowing the caller to
mutate agent state after assignment. This violates the defensive-copy requirement for
caller-provided collections.
Agent Prompt
## Issue description
`Agent.SetSkills` stores the input `skills` list by reference instead of copying it.

## Issue Context
Callers can retain the reference and mutate it later, causing unexpected agent state changes.

## Fix Focus Areas
- src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs[356-359]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

/// </summary>
public IList<Skills.AgentSkill> GetAgentSkills()
{
return _agentSkills?.Skills ?? new List<Skills.AgentSkill>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. getagentskills() returns internal list 📘 Rule violation ⛯ Reliability

SkillService.GetAgentSkills() returns _agentSkills.Skills directly, exposing internal mutable
state to callers. External mutation can corrupt the service's cached skill state across requests.
Agent Prompt
## Issue description
`GetAgentSkills()` exposes the internal `_agentSkills.Skills` list by reference.

## Issue Context
This creates shared mutable state where callers can modify the internal cache unintentionally.

## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Services/SkillService.cs[110-113]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +49 to +55
if (!allowedFiles.Contains(filePath))
{
contents = $"Error: File '{filePath}' is not a valid Skill-file";
}

contents = File.ReadAllText(args.FilePath, Encoding.UTF8);
message.Content = contents;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. read-skill-file-content ignores allowlist 📘 Rule violation ⛯ Reliability

GetSkillFileContentFn.Execute sets an error when the requested file is not allowed but still reads
the file unconditionally, risking exceptions and unsafe behavior. This violates the requirement to
add safe fallbacks at external/optional boundaries.
Agent Prompt
## Issue description
The function writes an error message for disallowed paths but still reads the file, which can throw or leak content.

## Issue Context
This is an external boundary (tool input from the model/user) and must have safe fallbacks when invalid.

## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillFileContentFn.cs[45-56]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

var agentId = _routingCtx.GetCurrentAgentId();
var agent = await _agentService.GetAgent(agentId);
var Skills = _skillService.GetAgentSkills(agent);
var args = JsonSerializer.Deserialize<GetSkillArgs>(message.FunctionArgs) ?? new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. functionargs null not handled 📘 Rule violation ⛯ Reliability

GetSkillBynameFn.Execute deserializes message.FunctionArgs without checking for null/empty,
which can throw at runtime. This violates the requirement for null/empty guards at optional
boundaries.
Agent Prompt
## Issue description
`FunctionArgs` is deserialized without checking for null/empty, which can throw exceptions.

## Issue Context
Tool calls can arrive without arguments or with invalid JSON; the handler should return a safe error message.

## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetSkillBynameFn.cs[34-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +99 to +103
functions.Add(new FunctionDef
{
Name = "GetInstructionsFn",
Description = $"Get a list of the available skills"
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

6. getinstructionsfn name mismatch 📘 Rule violation ✓ Correctness

AgentSkillsFunctionHook registers a function named GetInstructionsFn, but the callback tool name
is get-available-skills, creating a contract mismatch. This breaks consistent API/tool naming and
can prevent correct tool binding.
Agent Prompt
## Issue description
The function hook registers `Name = "GetInstructionsFn"` but the callback tool name is `"get-available-skills"`, causing contract mismatch.

## Issue Context
Tool routing typically matches function definitions and callbacks by name; inconsistent naming prevents correct binding.

## Fix Focus Areas
- src/Plugins/BotSharp.Plugin.AgentSkills/Hooks/AgentSkillsFunctionHook.cs[99-103]
- src/Plugins/BotSharp.Plugin.AgentSkills/Functions/GetInstructionsFn.cs[24-26]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

public List<AgentRuleMongoElement> Rules { get; set; }
public AgentLlmConfigMongoModel? LlmConfig { get; set; }

public List<AgentSkillMongoElement>? Skills { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

8. Mongo skills dropped on read 🐞 Bug ✓ Correctness

Mongo storage adds/persists AgentDocument.Skills but TransformAgentDocument does not map it back to
Agent.Skills, so skills are silently lost when agents are loaded from MongoDB. This causes agents to
appear without skills despite persisted data.
Agent Prompt
### Issue description
Skills are stored in Mongo but never restored into the domain Agent model.

### Issue Context
This results in silent loss of configured skills for any agent retrieved from MongoDB.

### Fix Focus Areas
- src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Agent.cs[763-799]
- src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentDocument.cs[27-33]
- src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentSkillMongoElement.cs[27-43]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Use a case-insensitive comparison when finding an AgentSkill (agentskills.FirstOrDefault now uses s.Name.Equals(skill.Name, StringComparison.OrdinalIgnoreCase)) to avoid missing matches due to casing. Also fix a validation bug in AgentSkill: the code now checks Description.Length (not Name.Length) against the 1-1024 character limit so the description length constraint is enforced correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants